﻿<Page x:Class="XBAP.Page1"
		xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
		xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:s="clr-namespace:DiagramDesigner;assembly=DiagramDesigner"
        xmlns:local="clr-namespace:DemoApp;assembly=DemoApp"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
        mc:Ignorable="d" 
        d:DesignHeight="300" d:DesignWidth="300"
        Name="mainPage"
        Title="Diagram Designer">
	
    <!--<Window.InputBindings>
        <KeyBinding Key="Del" Command="{Binding DeleteSelectedItemsCommand}" />
    </Window.InputBindings>-->
	
	<DockPanel Margin="0">
        <ToolBar Height="35" DockPanel.Dock="Top">
            <Button ToolTip="Create New Component"
                    Content="New Component"
					Margin="5,0,10,0"
                    Command="{Binding CreateNewDiagramCommand}"/>
            <Separator></Separator>
            <Button ToolTip="Save Component to File"
                    Content="Save"
                    Margin="10,0,5,0"
                    Command="{Binding SaveDiagramCommand}" />
            <Button ToolTip="Deposit Component to Cloud"
                    Content="Deposit"
                    Margin="5,0,10,0"
                    Command="{Binding StoreDiagramCommand}" />
            <Separator></Separator>
            <!--<ComboBox Margin="8,0,3,0"
                     Width="200"
                     ToolTip="Saved Diagrams"
                      SelectedItem="{Binding SavedDiagramId}"
                     ItemsSource="{Binding SavedDiagrams}"/>-->
            <Button ToolTip="Browse Component"
                    Content="Browse"
                    Margin="10,0,5,0"
                    Command="{Binding BrowseDiagramCommand}" />
            <Button ToolTip="Load Selected Component"
                    Content="Load"
                    Margin="5,0,5,0"
                    Command="{Binding LoadDiagramCommand}" />
            <Separator></Separator>
            <Button ToolTip="Load Component from Cloud"
                    Content="Load from Cloud"
                    Margin="5,0,5,0"
                    Command="{Binding LoadCloudCommand}" />
            <Label Margin="5,0,5,0"
                   VerticalAlignment="Center"
                   Content="{Binding FilePath}"
                   Foreground="Red"/>
            <ProgressBar Margin="0,0,0,0"
                    Visibility="{Binding Path=IsBusy, Converter={x:Static s:BoolToVisibilityConverter.Instance}}"
                    IsIndeterminate="True"
                    Width="150"
                    Height="20"
                    VerticalAlignment="Center" />
        </ToolBar>

        <Grid Margin="0,5,0,0">
			<Grid.ColumnDefinitions>
				<ColumnDefinition Width="230" />
				<ColumnDefinition />
			</Grid.ColumnDefinitions>

            <!-- ToolBox Control -->
            <local:ToolBoxControl Grid.Column="0"
                                  DataContext="{Binding ToolBoxViewModel}" />

            <GridSplitter Grid.Column="1"
						  HorizontalAlignment="Left"
						  VerticalAlignment="Stretch"
						  Background="Transparent"
						  Width="3" />
        
            <!-- Diagram Control -->
            <s:DiagramControl Grid.Column="1"
                                  DataContext="{Binding DiagramViewModel}"
                                  Margin="3,1,0,0" />
        </Grid>
	</DockPanel>    
	
</Page>
